package com.tianyi.sfzy1.service;

import com.tianyi.sfzy1.domain.Coursediscussion;
//import com.tianyi.sfzy1.domain.CoursediscussionMember;
import com.tianyi.sfzy1.mapper.CoursediscussionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Service
public class CoursediscussionService {
    @Autowired
    private CoursediscussionMapper coursediscussionMapper;

    //查询所有
    public List<Coursediscussion> findAll() {
        return coursediscussionMapper.findAll();
    }

    //多表查询 课程交流表 会员表
    public List<Coursediscussion> findCourseDiscussionAndMember() {
        return coursediscussionMapper.findCourseDiscussionAndMember();
    }

//    //根据id查询
    public Coursediscussion selectByPrimaryKey(int discussionId) {
        return coursediscussionMapper.selectByPrimaryKey(discussionId);
    }

    //添加
    public int insert(Coursediscussion record) {
        return coursediscussionMapper.insert(record);
    }

    //修改
    public int updateByPrimaryKey(Coursediscussion record) {
        return coursediscussionMapper.updateByPrimaryKey(record);
    }

    //删除
    public int deleteByPrimaryKey(int discussionId) {
        return coursediscussionMapper.deleteByPrimaryKey(discussionId);
    }

    //    批量删除课程
    public int deleteSelect(@RequestBody List<Integer> list){
        return coursediscussionMapper.deleteSelect(list);
    }
}
